
using System;
using Plain;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace Plain.Search
{
	public class SearchResult<T> : ISearchResult<T> 
	{
		private IEnumerable<T> e;
		private Criteria crit;
		
		public SearchResult(IEnumerable<T> e){
			this.e = e;
			
		}
		public SearchResult(Criteria c){
			crit = c;
			
		}
		int ISearchResult<T>.Count (){
			if(e==null){
				return 0;//PlainApplication.Config.DaoFactory.GetDao<T,TT>().GetCount(crit,null);
				
			}else {return 0;}
		}
			IEnumerator<T> IEnumerable<T>.GetEnumerator ()
		{
			if(e==null){
				//e = PlainApplication.Config.DaoFactory.GetDao<T,TT>().Search(crit);
			}
			if(e!=null){
				return e.GetEnumerator();
			}else return null;
			
		}
		IEnumerator IEnumerable.GetEnumerator ()
		{
			return ((IEnumerable<T>)this).GetEnumerator();
		}
			
		
	}
}

